package com.yy.wga.merchant.service.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yy.wga.common.core.dto.Result;
import com.yy.wga.common.util.mapping.BeansUtils;
import com.yy.wga.common.web.intereceptor.RequestHolder;
import com.yy.wga.merchant.feign.api.MerchantShareContentFeign;
import com.yy.wga.merchant.feign.response.MerchantShareContentInfoResp;
import com.yy.wga.merchant.service.pojo.MerchantShareContentDO;
import com.yy.wga.merchant.service.service.MerchantShareContentService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;


/**
 * 分销文案配置
 *
 * @author guochao
 * @since 2024-11-10 21:11:06
 */
@Component
public class MerchantShareContentController implements MerchantShareContentFeign {
    @Resource
    private MerchantShareContentService merchantShareContentService;

    @Override
    public Result<MerchantShareContentInfoResp> get() {
        MerchantShareContentDO shareContentDO = merchantShareContentService.getOne(new LambdaQueryWrapper<MerchantShareContentDO>()
                .eq(MerchantShareContentDO::getAppKey, RequestHolder.getBaseRequest().getAppKey()));
        return Result.success(BeansUtils.map(shareContentDO, MerchantShareContentInfoResp.class));
    }
}
